﻿namespace HRM.CORE
{
    using DevExpress.XtraBars;
    using DevExpress.XtraEditors;
    using APP.HELPER;
    using Common.Class; using APP.HELPER.Utils.Language; using Security.Security; using Dictionary.ERP;
    using HRM.CORE;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms; using Common;

    public class xfmTimekeepingPrivate : XtraForm
    {
        private bool _search;
        private IContainer components;
        private System.DateTime m_Date;
        private string m_EmployeeCode;
        private string m_ShiftCode;
        private Guid m_TimeKeeperTableListID;
        private xucTimekeepingPrivate ucList;

        public event AddedEventHander Added;

        public event DeletedEventHander Deleted;

        public event ItemSelectedEventHander ItemSelected;

        public event UpdatedEventHander Updated;

        public xfmTimekeepingPrivate()
        {
            this.components = null;
            this._search = false;
            this.InitializeComponent();
            this.Init();
        }

        public xfmTimekeepingPrivate(bool search)
        {
            this.components = null;
            this._search = false;
            this._search = search;
            this.InitializeComponent();
            this.Init();
        }

        public xfmTimekeepingPrivate(Guid TimeKeeperTableListID, string EmployeeCode, string ShiftCode, System.DateTime Date)
        {
            this.components = null;
            this._search = false;
            this.InitializeComponent();
            this.m_TimeKeeperTableListID = TimeKeeperTableListID;
            this.m_EmployeeCode = EmployeeCode;
            this.m_ShiftCode = ShiftCode;
            this.m_Date = Date;
            HRM_EMPLOYEE hrm_employee = new HRM_EMPLOYEE();
            hrm_employee.Get(this.m_EmployeeCode);
            DIC_SHIFT dic_shift = new DIC_SHIFT();
            dic_shift.Get(this.m_ShiftCode);
            this.Text = this.Text + " - " + hrm_employee.FirstName + " " + hrm_employee.LastName + " (Ng\x00e0y " + this.m_Date.ToShortDateString() + "; " + dic_shift.ShiftName + ")";
            this.Init();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void Init()
        {
            SYS_LOG.Insert("Tăng Cường Sau Ca L\x00e0m Việc", "Xem");
            this.ucList.SetData(this.m_TimeKeeperTableListID, this.m_EmployeeCode, this.m_ShiftCode, this.m_Date);
            this.ucList.CloseClick += new ButtonClickEventHander(this.ucList_CloseClick);
            this.ucList.Added += new xucTimekeepingPrivate.AddedEventHander(this.ucList_Added);
            this.ucList.Updated += new xucTimekeepingPrivate.UpdatedEventHander(this.ucList_Updated);
            this.ucList.Deleted += new DeletedEventHander(this.ucList_Deleted);
            this.Text = (SysOption.Language == "EN") ? "Shift" : this.Text;
        }

        private void InitializeComponent()
        {
            MenuButton button = new MenuButton();
            ItemCommand command = new ItemCommand();
            ItemCommand command2 = new ItemCommand();
            ItemCommand command3 = new ItemCommand();
            ItemCommand command4 = new ItemCommand();
            ItemCommand command5 = new ItemCommand();
            ItemCommand command6 = new ItemCommand();
            ItemCommand command7 = new ItemCommand();
            ItemCommand command8 = new ItemCommand();
            ItemCommand command9 = new ItemCommand();
            ItemCommand command10 = new ItemCommand();
            ItemCommand command11 = new ItemCommand();
            ItemCommand command12 = new ItemCommand();
            ItemCommand command13 = new ItemCommand();
            ItemCommand command14 = new ItemCommand();
            ItemCommand command15 = new ItemCommand();
            ItemCommand command16 = new ItemCommand();
            ItemCommand command17 = new ItemCommand();
            ItemCommand command18 = new ItemCommand();
            ItemCommand command19 = new ItemCommand();
            ItemCommand command20 = new ItemCommand();
            ItemCommand command21 = new ItemCommand();
            ItemCommand command22 = new ItemCommand();
            ItemCommand command23 = new ItemCommand();
            ItemCommand command24 = new ItemCommand();
            ItemCommand command25 = new ItemCommand();
            ItemCommand command26 = new ItemCommand();
            ItemCommand command27 = new ItemCommand();
            ItemCommand command28 = new ItemCommand();
            ItemCommand command29 = new ItemCommand();
            this.ucList = new xucTimekeepingPrivate();
            base.SuspendLayout();
            this.ucList.Dock = DockStyle.Fill;
            this.ucList.IsClose = CloseOrNew.None;
            this.ucList.IsSearch = false;
            this.ucList.Location = new Point(0, 0);
            this.ucList.Name = "ucList";
            this.ucList.NotSave = false;
            command.Caption = "";
            command.Enable = false;
            command.Visibility = BarItemVisibility.Never;
            button.Add = command;
            command2.Caption = "";
            command2.Enable = false;
            command2.Visibility = BarItemVisibility.Never;
            button.Cancel = command2;
            command3.Caption = "";
            command3.Enable = false;
            command3.Visibility = BarItemVisibility.Never;
            button.Change = command3;
            command4.Caption = "";
            command4.Enable = false;
            command4.Visibility = BarItemVisibility.Never;
            button.Close = command4;
            command5.Caption = "";
            command5.Enable = false;
            command5.Visibility = BarItemVisibility.Never;
            button.Custom = command5;
            command6.Caption = "";
            command6.Enable = false;
            command6.Visibility = BarItemVisibility.Never;
            button.Delete = command6;
            command7.Caption = "";
            command7.Enable = false;
            command7.Visibility = BarItemVisibility.Never;
            button.Export = command7;
            command8.Caption = "";
            command8.Enable = false;
            command8.Visibility = BarItemVisibility.Never;
            button.Filter = command8;
            command9.Caption = "";
            command9.Enable = false;
            command9.Visibility = BarItemVisibility.Never;
            button.FilterCustomer = command9;
            command10.Caption = "";
            command10.Enable = false;
            command10.Visibility = BarItemVisibility.Never;
            button.FilterStock = command10;
            command11.Caption = "";
            command11.Enable = false;
            command11.Visibility = BarItemVisibility.Never;
            button.Find = command11;
            button.GClose = false;
            button.GCommand = false;
            button.GExport = false;
            command12.Caption = "";
            command12.Enable = false;
            command12.Visibility = BarItemVisibility.Never;
            button.Go = command12;
            button.GOption = false;
            button.GPrint = false;
            button.GRecords = false;
            button.GSearchBar = false;
            button.GSettings = false;
            button.GVaildation = false;
            command13.Caption = "";
            command13.Enable = false;
            command13.Visibility = BarItemVisibility.Never;
            button.Import = command13;
            command14.Caption = "";
            command14.Enable = false;
            command14.Visibility = BarItemVisibility.Never;
            button.Next = command14;
            command15.Caption = "";
            command15.Enable = false;
            command15.Visibility = BarItemVisibility.Never;
            button.PageSetup = command15;
            button.PHome = false;
            command16.Caption = "";
            command16.Enable = false;
            command16.Visibility = BarItemVisibility.Never;
            button.Previous = command16;
            command17.Caption = "";
            command17.Enable = false;
            command17.Visibility = BarItemVisibility.Never;
            button.Print = command17;
            command18.Caption = "";
            command18.Enable = false;
            command18.Visibility = BarItemVisibility.Never;
            button.PrintPreview = command18;
            button.PTool = false;
            command19.Caption = "";
            command19.Enable = false;
            command19.Visibility = BarItemVisibility.Never;
            button.Redo = command19;
            command20.Caption = "";
            command20.Enable = false;
            command20.Visibility = BarItemVisibility.Never;
            button.Refresh = command20;
            command21.Caption = "";
            command21.Enable = false;
            command21.Visibility = BarItemVisibility.Never;
            button.Save = command21;
            command22.Caption = "";
            command22.Enable = false;
            command22.Visibility = BarItemVisibility.Never;
            button.SaveAndClose = command22;
            command23.Caption = "";
            command23.Enable = false;
            command23.Visibility = BarItemVisibility.Never;
            button.SaveAndNew = command23;
            command24.Caption = "";
            command24.Enable = false;
            command24.Visibility = BarItemVisibility.Never;
            button.Search = command24;
            command25.Caption = "";
            command25.Enable = false;
            command25.Visibility = BarItemVisibility.Never;
            button.SearchText = command25;
            command26.Caption = "";
            command26.Enable = false;
            command26.Visibility = BarItemVisibility.Never;
            button.Task = command26;
            command27.Caption = "";
            command27.Enable = false;
            command27.Visibility = BarItemVisibility.Never;
            button.Undo = command27;
            command28.Caption = "";
            command28.Enable = false;
            command28.Visibility = BarItemVisibility.Never;
            button.Vaildate = command28;
            command29.Caption = "";
            command29.Enable = false;
            command29.Visibility = BarItemVisibility.Never;
            button.View = command29;
            this.ucList.RibbonBar = button;
            this.ucList.Size = new Size(0x2dd, 0x1c5);
            this.ucList.Status = Actions.None;
            this.ucList.TabIndex = 0;
            this.ucList.Title = "";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x2dd, 0x1c5);
            base.Controls.Add(this.ucList);
            base.FormBorderStyle = FormBorderStyle.FixedSingle;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "xfmTimekeepingPrivate";
            base.ShowIcon = false;
            base.ShowInTaskbar = false;
            base.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "L\x00e0m Việc Ri\x00eang";
            base.ResumeLayout(false);
        }

        public void RaiseAddedEventHander(HRM_TIMEKEEPER_PRIVATE Item)
        {
            if (this.Added != null)
            {
                this.Added(this, Item);
            }
        }

        public void RaiseDeletedEventHander(RowClickEventArgs e)
        {
            if (this.Deleted != null)
            {
                this.Deleted(this, e);
            }
        }

        private void RaiseItemSelectedEventHander(HRM_TIMEKEEPER_PRIVATE item)
        {
            if (this.ItemSelected != null)
            {
                this.ItemSelected(this, item);
            }
        }

        public void RaiseUpdatedEventHander(HRM_TIMEKEEPER_PRIVATE Item)
        {
            if (this.Updated != null)
            {
                this.Updated(this, Item);
            }
        }

        private void ucList_Added(object sender, HRM_TIMEKEEPER_PRIVATE Item)
        {
            this.RaiseAddedEventHander(Item);
        }

        private void ucList_CloseClick(object sender)
        {
            base.Close();
        }

        private void ucList_Deleted(object sender, RowClickEventArgs e)
        {
            this.RaiseDeletedEventHander(e);
        }

        private void ucList_Updated(object sender, HRM_TIMEKEEPER_PRIVATE Item)
        {
            this.RaiseUpdatedEventHander(Item);
        }

        public bool IsSearch
        {
            set
            {
                this.ucList.IsSearch = value;
            }
        }

        public delegate void AddedEventHander(object sender, HRM_TIMEKEEPER_PRIVATE Item);

        public delegate void DeletedEventHandler(object sender, RowClickEventArgs e);

        public delegate void ItemSelectedEventHander(object sender, HRM_TIMEKEEPER_PRIVATE item);

        public delegate void UpdatedEventHander(object sender, HRM_TIMEKEEPER_PRIVATE Item);
    }
}

